var garagesaleItemCtrl = $.mvc.controller.create('garagesale_item', {
    views: {
        //"garagesale_items_tpl": "views/garagesale_items.tpl",
        //"item_detail_tpl": "views/item_detail.tpl"
    },
    /* Array of views to load */
    save: function() {


    },
    getItems: function(id) {
        $.ui.loadContent("#item_panel",false,false,"slide");
        $.get(BASE_URL+"garagesale_items?id="+encodeURIComponent(id),
            function(obj){
                obj=JSON.parse(obj);
                $("#itemList").html($.template('garagesale_items_tpl', {
                    sale_items: obj
                }));
            }
        );
        /*garagesale_item.fetchBy(id,function(result) {
            $("#itemList").html($.template('garagesale_items_tpl', {
                sale_items: result
            }));
        });*/
    },
    detail: function(id) {
        $.ui.loadContent("#detail_panel",false,false,"slide");
        garagesale_item.fetch(id,function(result) {
            $("#detail_div").html($.template('item_detail_tpl', {
                item: result
            }));
        });
    },
    default:function() {
        /*garagesale_item.fetchAll(function(all) {
            $("#itemList").html($.template('garagesale_items_tpl', {
                items: all
            }));
        });*/

    },
    /* This is executed when the controller is created.  It assumes the views are loaded, but can not interact with models
     * This is useful for wiring up page events, etc.
     */
    init: function() {
        
    }
});